package echat.future.cn.echat.message.weekrank.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import echat.future.cn.echat.R;
import echat.future.cn.echat.message.bean.RankListBean;

/**
 * 往期活动
 * Created by JX on 2018/9/3.
 */

public class RankListAdapter extends BaseQuickAdapter<RankListBean, BaseViewHolder> {

    public RankListAdapter(int layoutResId, @Nullable List<RankListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, RankListBean item) {
        RequestOptions options = new RequestOptions();
        options.centerCrop()
                .placeholder(R.mipmap.ic_launcher);
        Glide.with(mContext).load(item.getActive_img()).apply(options).into((ImageView) helper.getView(R.id.iv_image));

        TextView tv = helper.getView(R.id.tv_status);
        tv.setBackgroundResource(item.getStatus() == 3 ? R.drawable.rank_list_end : R.drawable.rank_list_ing);

        if (item.getStatus() == 3) {
            tv.setText("已结束");
        }else if (item.getStatus() == 2) {
            tv.setText("进行中");
        }else {
            tv.setText("待开始");
        }
    }
}